package com.lcxw.hxzbapi.controller.membercontroller;

import com.alibaba.fastjson.JSONObject;
import com.lcxw.hxzbapi.entity.requestBean.RequestParamBasic;
import com.lcxw.hxzbapi.entity.requestBean.SubmitRealNameAuthReq;
import com.lcxw.hxzbapi.entity.response.Response;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("api/user/realNameAuth")
public class RealNameAuthController {

    @Resource
    MemberRealization memberRealization;


    /**
     * 提交实名认证接口，两元认证法
     */
    @PostMapping("/submit")
    public Response submitRealNameAuth(@RequestBody SubmitRealNameAuthReq requestBody) {
        return memberRealization.realNameAuth(requestBody);
    }

    /**
     * 查询实名认证状态
     */
    @PostMapping("/status/get")
    public Response getRealNameAuthStatus(@RequestBody RequestParamBasic requestBody) {
        long userId = Long.parseLong(requestBody.getUserId());
        return memberRealization.getRealNameAuthStatus(userId);
    }

}
